<script type="text/javascript"
     src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<head>
    <link rel="stylesheet" href="stylesheet_TMATS.css">
</head>

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<title>
    T-MATS: Help for Limit Selection Library Block
</title>

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<body>
    <h1>
      T-MATS: Limit Selection Library Block
    </h1>
<hr>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<div class="purpose">
        Purpose
</div>

<p>
    This block can be used to adjust a requested effector value by utilizing limit inputs.
    The limit inputs can be topping (maximum) or bottoming (minimum) limits.

<br>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<div class="background">
        Background
</div>

<p>
    To compute the Demand Value, this block utilizes a MATALB script that
    cycles through the input limit values and applies the effects of the
    limits (maximum or minimum) to the initially entered Request Value.

<br>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<div class="instructions">
        Instructions
</div>

<p>
    To use this block:
    <ul>
        <li> Connect the request value and limit value inputs to the corresponding places on the block.
        <li> Connect the outputs to the next blocks in your simulation.
        <li> Double click the block and adjust the vector values to account for
        the input values being topping limits (1) or bottoming limits (-1).
    </ul>
</p>

<br><hr><br>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<div class="inputs">
        Limit Selection Inputs
</div>

<table>
    <tr><th> Input </th><th >Description</th></tr>
    <tr><td>Request Value</td><td> Requested Value</td></tr>
    <tr><td>Limit Values</td><td> Values of limiters as a vector. These values may be changed for different conditions (1xn)</td></tr>

</table>

<br><br>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<div class="outputs">
        Limit Selection Outputs
</div>

<table>
    <tr><th> Output </th><th> Description </th></tr>
    <tr><td>Demand Value</td><td> Final value after limits are applied</td></tr>
    <tr><td>ActiveLimit</td><td> Value of the active limit.  The limit number will coincide with it's location in the Limit Values input vector</td></tr>
</table>

<br><br>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<div class="maskvars">
        Limit Selection Mask Variables
</div>

<table>
    <tr><th> Mask Variable </th><th> Description </th></tr>
    <tr><td>SelectVec_M</td><td>Values of 1 denote a topping limit and -1 denote a bottoming limit. The input must be in the form of a vector with the same number of values as the Limit Values input vector. (1xn)</td></tr>
    <tr><td>LimitsEn_M</td><td> Enable limits: 1- limits active, 0- limits disabled (1xn)</td></tr>
</table>

<br><br>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
</body>